package aiyh.utils.sqlUtil.whereUtil.impl;

import aiyh.utils.sqlUtil.whereUtil.InnerWhere;
import aiyh.utils.sqlUtil.whereUtil.InnerWhereOperator;
import aiyh.utils.sqlUtil.whereUtil.Where;

/**
 * @author EBU7-dev1-ayh
 * @date 2021/8/23 0023 13:18
 * 实现类
 */

@Deprecated
public class InnerWhereImpl implements InnerWhere {
	private final InnerWhereOperator whereOperator;
	private final WhereImpl where;

	{
		this.whereOperator = new InnerWhereOperatorImpl(this);
	}

	public InnerWhereOperator getWhereOperator() {
		return whereOperator;
	}

	public InnerWhereImpl(WhereImpl where) {
		this.where = where;
	}

	@Override
	public InnerWhereOperator whereAnd(String key) {
		this.where.whereAppend(" and ");
		this.where.whereAppend(key);
		return this.whereOperator;
	}

	@Override
	public InnerWhereOperator whereOr(String key) {
		this.where.whereAppend(" or ");
		this.where.whereAppend(key);
		return this.whereOperator;
	}


	@Override
	public Where endInnerWhere() {
		this.where.whereAppend(" ) ");
		return this.where;
	}

	public void whereAppend(Object key){
		this.where.whereAppend(key);
	}

}
